package com.linq.cool.common.core.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: yqlin
 * @Date: 2020/12/29 13:20
 * @Description: 请求参数基础类，带分页参数
 * @Version: 1.0.0
 */
@Data
@Accessors(chain = true)
@NoArgsConstructor
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = -7848180324428109438L;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @TableField(value = "gmt_create")
    private Date gmtCreate;

    @TableField(value = "gmt_modified")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date gmtModified;

    @TableField(value = "modifier")
    private Long modifier;

    @TableField(value = "creator")
    private Long creator;

    /**
     * 以及传入beginTime和endTime的时候会用到
     */
    @TableField(exist = false)
    private Map<String, Object> params;

    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>(2);
        }
        return params;
    }
}
